package edu.hunau.service.impl;

import edu.hunau.dao.OrderDao;
import edu.hunau.dao.OrderItemDao;
import edu.hunau.pojo.Order;
import edu.hunau.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author hb
 * @date 2023-04-14 15:50:43
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private OrderDao orderDao;
    @Resource
    private OrderItemDao orderItemDao;
    @Override
    public int createOrder(Order order) {
        System.out.println("OrderServiceImpl#createOrder(Order)");
        int oid=orderDao.insert(order);
        orderItemDao.insertBatch(oid,order.getItems());
        return oid;
    }
}
